\hypertarget{interface_tic_tac_controller}{
\section{TicTacController Class Reference}
\label{interface_tic_tac_controller}\index{TicTacController@{TicTacController}}
}


\hyperlink{interface_tic_tac_controller}{TicTacController} is the main controller in the MVC pattern for the tic tac toe game.  


{\ttfamily \#import $<$TicTacController.h$>$}\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
(IBAction) -\/ \hyperlink{interface_tic_tac_controller_ad0c4728c17ed5445e7bd7af34d5037a6}{newGame:}
\begin{DoxyCompactList}\small\item\em Starts a new game, clears the existing model, refreshes the screen, and enables the grid. \item\end{DoxyCompactList}\item 
(IBAction) -\/ \hyperlink{interface_tic_tac_controller_a27821808ba4b594510c4275c3344b82f}{changeComputerSkillLevel:}
\begin{DoxyCompactList}\small\item\em Call this to commit the current computer skill level. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_controller_aebb1d5caf64f16f4b816c3b08a3ee311}{takeTurns:}
\begin{DoxyCompactList}\small\item\em Call this with the desired human position for proper gameplay. \item\end{DoxyCompactList}\item 
(bool) -\/ \hyperlink{interface_tic_tac_controller_a99e74d96856662121336c5c60788b6e7}{humanTakeTurn:}
\begin{DoxyCompactList}\small\item\em Internal. Use takeTurns for proper workflow. \item\end{DoxyCompactList}\item 
\hypertarget{interface_tic_tac_controller_af0075f2fa49d4bb1a0b152dffc8c4993}{
(void) -\/ \hyperlink{interface_tic_tac_controller_af0075f2fa49d4bb1a0b152dffc8c4993}{computerTakeTurn}}
\label{interface_tic_tac_controller_af0075f2fa49d4bb1a0b152dffc8c4993}

\begin{DoxyCompactList}\small\item\em Internal. Use takeTurns for proper workflow. Computer's turn. \item\end{DoxyCompactList}\item 
(\hyperlink{interface_tic_tac_model}{TicTacModel} $\ast$) -\/ \hyperlink{interface_tic_tac_controller_a7560a8dba8865c2c954b7da4593305f6}{getModel}
\begin{DoxyCompactList}\small\item\em Retrives the model used by the controller. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_controller_a7e96735c3483e39329016cacf9439559}{humanEventNotificationHandler:}
\begin{DoxyCompactList}\small\item\em Handles the HumanPerformedEventNotification event. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
IBOutlet \hyperlink{interface_tic_tac_view}{TicTacView} $\ast$ \hyperlink{interface_tic_tac_controller_abf2b51f71392b4de8e826ba764d1fde4}{myView}
\item 
\hyperlink{interface_tic_tac_model}{TicTacModel} $\ast$ \hyperlink{interface_tic_tac_controller_a4e93f2d35a13ccaeea1f439f49aa1021}{myModel}
\item 
IBOutlet NSSliderCell $\ast$ \hyperlink{interface_tic_tac_controller_a6013d371144ba403cfbe08c998d9872b}{currentComputerSkill}
\item 
\hyperlink{interface_tic_tac_opponent}{TicTacOpponent} $\ast$ \hyperlink{interface_tic_tac_controller_ad7b3b6dc67306211fddd00fc2f63b77d}{opponent}
\item 
bool \hyperlink{interface_tic_tac_controller_a52a1b11a3ee4605d9882eb42c57ecf51}{allowMoves}
\item 
int \hyperlink{interface_tic_tac_controller_acf90c6b009f9d9ea2ec2d71053caf993}{humanPlayer}
\item 
int \hyperlink{interface_tic_tac_controller_aad1399c55d2712da01709c3424362f12}{computerPlayer}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{interface_tic_tac_controller}{TicTacController} is the main controller in the MVC pattern for the tic tac toe game. It is expected that the controller is setup in the xib to be an instance on application startup. 

\subsection{Member Function Documentation}
\hypertarget{interface_tic_tac_controller_a27821808ba4b594510c4275c3344b82f}{
\index{TicTacController@{TicTacController}!changeComputerSkillLevel:@{changeComputerSkillLevel:}}
\index{changeComputerSkillLevel:@{changeComputerSkillLevel:}!TicTacController@{TicTacController}}
\subsubsection[{changeComputerSkillLevel:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (IBAction) changeComputerSkillLevel: (id) {\em pId}}}
\label{interface_tic_tac_controller_a27821808ba4b594510c4275c3344b82f}


Call this to commit the current computer skill level. \begin{Desc}
\item[\hyperlink{todo__todo000001}{Todo}]this should be revisisted to figure out how to propery hook up an NSSlider without having a reference in the controller. \end{Desc}

\begin{DoxyParams}{Parameters}
\item[{\em pId}]not used. This is here to enable connections in the xib. \end{DoxyParams}
\hypertarget{interface_tic_tac_controller_a7560a8dba8865c2c954b7da4593305f6}{
\index{TicTacController@{TicTacController}!getModel@{getModel}}
\index{getModel@{getModel}!TicTacController@{TicTacController}}
\subsubsection[{getModel}]{\setlength{\rightskip}{0pt plus 5cm}-\/ ({\bf TicTacModel} $\ast$) getModel }}
\label{interface_tic_tac_controller_a7560a8dba8865c2c954b7da4593305f6}


Retrives the model used by the controller. \begin{DoxyReturn}{Returns}
the data model. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_controller_a7e96735c3483e39329016cacf9439559}{
\index{TicTacController@{TicTacController}!humanEventNotificationHandler:@{humanEventNotificationHandler:}}
\index{humanEventNotificationHandler:@{humanEventNotificationHandler:}!TicTacController@{TicTacController}}
\subsubsection[{humanEventNotificationHandler:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) humanEventNotificationHandler: (NSNotification $\ast$) {\em notification}}}
\label{interface_tic_tac_controller_a7e96735c3483e39329016cacf9439559}


Handles the HumanPerformedEventNotification event. 
\begin{DoxyParams}{Parameters}
\item[{\em notification}]The object property in the notification should be a TicTacPosition$\ast$ Leverages the cocoa message center with NSNotificationCenter. This will invoke takeTurns. \end{DoxyParams}
\hypertarget{interface_tic_tac_controller_a99e74d96856662121336c5c60788b6e7}{
\index{TicTacController@{TicTacController}!humanTakeTurn:@{humanTakeTurn:}}
\index{humanTakeTurn:@{humanTakeTurn:}!TicTacController@{TicTacController}}
\subsubsection[{humanTakeTurn:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (bool) humanTakeTurn: ({\bf TicTacPosition} $\ast$) {\em humanDesiredPosition}}}
\label{interface_tic_tac_controller_a99e74d96856662121336c5c60788b6e7}


Internal. Use takeTurns for proper workflow. 
\begin{DoxyParams}{Parameters}
\item[{\em humanDesiredPosition}]the position for the human. \end{DoxyParams}
\hypertarget{interface_tic_tac_controller_ad0c4728c17ed5445e7bd7af34d5037a6}{
\index{TicTacController@{TicTacController}!newGame:@{newGame:}}
\index{newGame:@{newGame:}!TicTacController@{TicTacController}}
\subsubsection[{newGame:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (IBAction) newGame: (id) {\em pId}}}
\label{interface_tic_tac_controller_ad0c4728c17ed5445e7bd7af34d5037a6}


Starts a new game, clears the existing model, refreshes the screen, and enables the grid. 
\begin{DoxyParams}{Parameters}
\item[{\em pId}]not used. This is here to enable connections in the xib. \end{DoxyParams}
\hypertarget{interface_tic_tac_controller_aebb1d5caf64f16f4b816c3b08a3ee311}{
\index{TicTacController@{TicTacController}!takeTurns:@{takeTurns:}}
\index{takeTurns:@{takeTurns:}!TicTacController@{TicTacController}}
\subsubsection[{takeTurns:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) takeTurns: ({\bf TicTacPosition}$\ast$) {\em humanDesiredPosition}}}
\label{interface_tic_tac_controller_aebb1d5caf64f16f4b816c3b08a3ee311}


Call this with the desired human position for proper gameplay. 
\begin{DoxyParams}{Parameters}
\item[{\em humanDesiredPosition}]the position the human wants. In reality this is connected to \end{DoxyParams}


\subsection{Member Data Documentation}
\hypertarget{interface_tic_tac_controller_a52a1b11a3ee4605d9882eb42c57ecf51}{
\index{TicTacController@{TicTacController}!allowMoves@{allowMoves}}
\index{allowMoves@{allowMoves}!TicTacController@{TicTacController}}
\subsubsection[{allowMoves}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (bool) {\bf allowMoves}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_a52a1b11a3ee4605d9882eb42c57ecf51}
Whether or not anybody is allowed to move. \hypertarget{interface_tic_tac_controller_aad1399c55d2712da01709c3424362f12}{
\index{TicTacController@{TicTacController}!computerPlayer@{computerPlayer}}
\index{computerPlayer@{computerPlayer}!TicTacController@{TicTacController}}
\subsubsection[{computerPlayer}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (int) {\bf computerPlayer}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_aad1399c55d2712da01709c3424362f12}
The player code for the computer player, could be TICTAC\_\-X, or TICTAC\_\-O \hypertarget{interface_tic_tac_controller_a6013d371144ba403cfbe08c998d9872b}{
\index{TicTacController@{TicTacController}!currentComputerSkill@{currentComputerSkill}}
\index{currentComputerSkill@{currentComputerSkill}!TicTacController@{TicTacController}}
\subsubsection[{currentComputerSkill}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (IBOutlet NSSliderCell$\ast$) {\bf currentComputerSkill}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_a6013d371144ba403cfbe08c998d9872b}
A slider indicating the current computer skill. TODO: this should really just be a level, not a sliderCell, but I couldn't figure out how to connect just an int over to the intValue of the slider properly. \hypertarget{interface_tic_tac_controller_acf90c6b009f9d9ea2ec2d71053caf993}{
\index{TicTacController@{TicTacController}!humanPlayer@{humanPlayer}}
\index{humanPlayer@{humanPlayer}!TicTacController@{TicTacController}}
\subsubsection[{humanPlayer}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (int) {\bf humanPlayer}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_acf90c6b009f9d9ea2ec2d71053caf993}
The player code for the human player, could be TICTAC\_\-X, or TICTAC\_\-O \hypertarget{interface_tic_tac_controller_a4e93f2d35a13ccaeea1f439f49aa1021}{
\index{TicTacController@{TicTacController}!myModel@{myModel}}
\index{myModel@{myModel}!TicTacController@{TicTacController}}
\subsubsection[{myModel}]{\setlength{\rightskip}{0pt plus 5cm}-\/ ({\bf TicTacModel}$\ast$) {\bf myModel}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_a4e93f2d35a13ccaeea1f439f49aa1021}
The data model to be manipulated. This is owned by the controller. \hypertarget{interface_tic_tac_controller_abf2b51f71392b4de8e826ba764d1fde4}{
\index{TicTacController@{TicTacController}!myView@{myView}}
\index{myView@{myView}!TicTacController@{TicTacController}}
\subsubsection[{myView}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (IBOutlet {\bf TicTacView}$\ast$) {\bf myView}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_abf2b51f71392b4de8e826ba764d1fde4}
Reference to the tic tac view. It is expected that this is connected to the view in the xib. \hypertarget{interface_tic_tac_controller_ad7b3b6dc67306211fddd00fc2f63b77d}{
\index{TicTacController@{TicTacController}!opponent@{opponent}}
\index{opponent@{opponent}!TicTacController@{TicTacController}}
\subsubsection[{opponent}]{\setlength{\rightskip}{0pt plus 5cm}-\/ ({\bf TicTacOpponent}$\ast$) {\bf opponent}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_controller_ad7b3b6dc67306211fddd00fc2f63b77d}
The computer opponent. This is owned by the controller. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
TicTacController.h\item 
TicTacController.m\end{DoxyCompactItemize}
